package com.cy.model;

import com.cy.BasicModel;
import com.cy.ext.plugin.tablebind.TableBind;

import java.util.List;

@TableBind(tableName="product_of_output",pkName = "id")
public class ProductOfOutput extends BasicModel<ProductOfOutput> {
    public static final ProductOfOutput dao = new ProductOfOutput();
    public static final String SELECT_ALL = "`id`,`sn`,`output_id`";

    public ProductOfOutput setId(Long id){
        return this.set("id",id);
    }

    public Long getId(){
        return this.get("id");
    }
            
    public ProductOfOutput setSn(String sn){
        return this.set("sn",sn);
    }

    public String getSn(){
        return this.getStr("sn");
    }
        
    public ProductOfOutput setOutputId(Long outputId){
        return this.set("output_id",outputId);
    }

    public Long getOutputId(){
        return this.get("output_id");
    }

    public ProductOfOutput findBySn(String sn) {
        return findFirst("select * from product_of_output where sn = ?", sn);
    }

    public List<ProductOfOutput> findByOutputId(Long recordId) {
        return find("select * from product_of_output where output_id = ? order by sn", recordId);
    }
}